

// let myTools = require('./libs/mytools');

cc.Class({
    extends: cc.Component,

    properties: {
        lb_value:cc.Label,
    },

    // LIFE-CYCLE CALLBACKS:
    // onLoad () {},

    start () {

    },

    // update (dt) {},

    getValue(){
        let text = this.lb_value.string.trim();
        if(text.length < 1){
            return 0;
        }else{
            return parseInt(text);
        }
    },

    setValue(value){
        // if(!myTools.Types.isNumber(value)){
        //     throw new Error(`value:${value} 应该为number类型`);
        // }
        this.lb_value.string = value;
        if(value === 0){
            this.lb_value.node.active = false;
        }else{
            this.lb_value.node.active = true;
        }
    }
});
